﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Automted_Bank_teller
{
    public partial class NewClientRegisteration : Form
    {
        public NewClientRegisteration()
        {
            InitializeComponent();
        }

        private void NewClientRegisteration_Load(object sender, EventArgs e)
        {

        }

        private void label9_Click(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void BTN_ClientRegisteratin_Submit_Click(object sender, EventArgs e)
        {
            try{
            Registeration_Logic client_register = new Registeration_Logic();
            client_register.Set_data_for_ClientRegister(txtbox_clientRegister_Fname.Text, txtbox_clientRegister_Mname.Text, txtbox_clientRegister_Lname.Text, txtbox_clientRegister_PhoneNumber.Text, txtbox_clientRegister_Address.Text, txtbox_clientRegister_clientGovernment.Text, txtbox_clientRegister_clientCity.Text, txtbox_clientRegister_Email.Text, txtbox_clientRegister_SSN.Text, txtbox_clientRegister_client_ID.Text, txtbox_clientRegister_pinCode.Text, float.Parse(txtbox_clientRegister_AccountBalance.Text));

            Registeration_Process complete_register = new Registeration_Process();

            if (txtbox_clientRegister_Fname.Text.Length > 0 && txtbox_clientRegister_Mname.Text.Length > 0 && txtbox_clientRegister_Lname.Text.Length > 0 && txtbox_clientRegister_PhoneNumber.Text.Length > 0 && txtbox_clientRegister_Address.Text.Length > 0 && txtbox_clientRegister_clientGovernment.Text.Length > 0 && txtbox_clientRegister_clientCity.Text.Length > 0 && txtbox_clientRegister_Email.Text.Length > 0 && txtbox_clientRegister_SSN.Text.Length > 0 && txtbox_clientRegister_client_ID.Text.Length > 0 && txtbox_clientRegister_pinCode.Text.Length > 0 && txtbox_clientRegister_AccountBalance.Text.Length > 0)
            {
                complete_register.Database_ConnectString();
                complete_register.insert_data_for_Clientregister();
                complete_register.Open_Database();
                complete_register.ExecuteQuery();
                complete_register.Close_Database();
                MessageBox.Show("successful Registeration");
                this.Close();
                this.Hide();
                ClientLoginForm login = new ClientLoginForm();
                login.ShowDialog();
               
            }
            else
            {
                MessageBox.Show("Stop!..Empty Fields Not Allowed");
            }

            }catch(Exception Ex)
             {
                 MessageBox.Show(Ex.Message);
             }
        }
    }
}
